package com.youyi.yyviewsdklibrary.picker.entity;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

public class TimeEntity implements Serializable {
    private int hour;
    private int minute;
    private int second;

    public static TimeEntity target(int i, int i2, int i3) {
        TimeEntity timeEntity = new TimeEntity();
        timeEntity.setHour(i);
        timeEntity.setMinute(i2);
        timeEntity.setSecond(i3);
        return timeEntity;
    }

    public static TimeEntity target(Calendar calendar) {
        return target(calendar.get(11), calendar.get(12), calendar.get(13));
    }

    public static TimeEntity target(Date date) {
        Calendar instance = Calendar.getInstance();
        instance.setTime(date);
        return target(instance);
    }

    public static TimeEntity now() {
        return target(Calendar.getInstance());
    }

    public static TimeEntity minuteOnFuture(int i) {
        Calendar instance = Calendar.getInstance();
        instance.add(12, i);
        return target(instance);
    }

    public static TimeEntity hourOnFuture(int i) {
        Calendar instance = Calendar.getInstance();
        instance.add(11, i);
        return target(instance);
    }

    public int getHour() {
        return this.hour;
    }

    public void setHour(int i) {
        this.hour = i;
    }

    public int getMinute() {
        return this.minute;
    }

    public void setMinute(int i) {
        this.minute = i;
    }

    public int getSecond() {
        return this.second;
    }

    public void setSecond(int i) {
        this.second = i;
    }

    public long toTimeInMillis() {
        Calendar instance = Calendar.getInstance();
        instance.set(11, this.hour);
        instance.set(12, this.minute);
        instance.set(13, this.second);
        instance.set(14, 0);
        return instance.getTimeInMillis();
    }

    public String toString() {
        return this.hour + ":" + this.minute + ":" + this.second;
    }
}
